/*
<script type="text/javascript">
	var changercfg = {
		'delay' : 3000,
		'start_frame' : 0,
		'changer_id' : 'image-changer'
	};
</script>
 */
if(changercfg == undefined)
{
	var changercfg = {
		'delay' : 3000,
		'start_frame' : 0,
		'changer_id' : 'image-changer'
	};
}


function init() {
	var lis = $(changercfg.changer_id).getElementsByTagName('li');
	
	for( i=0; i < lis.length; i++){
		if(i!=0){
			lis[i].style.display = 'none';
		}
	}
	end_frame = lis.length -1;
	
	start_slideshow(changercfg.start_frame, end_frame, changercfg.delay, lis);
		
}



function start_slideshow(start_frame, end_frame, delay, lis) {
	setTimeout(fadeInOut(start_frame,start_frame,end_frame, delay, lis), delay);
}


function fadeInOut(frame, start_frame, end_frame, delay, lis) {
	return (function() {
		lis = $(changercfg.changer_id).getElementsByTagName('li');
		Effect.Fade(lis[frame]);
		if (frame == end_frame) { frame = start_frame; } else { frame++; }
		lisAppear = lis[frame];
		setTimeout("Effect.Appear(lisAppear);", 0);
		setTimeout(fadeInOut(frame, start_frame, end_frame, delay), delay + 1850);
	})
	
}


Event.observe(window, 'load', init, false);